<template>
    <div>
        <home-header :city="city"></home-header>
        <home-swiper :list="swiperList"></home-swiper>
        <home-icons :IconList="IconList"></home-icons>
        <home-recommend :list="recommendList"></home-recommend>
        <home-weekday :list="weekendList"></home-weekday>
    </div>
</template>

<script>
import HomeHeader from './components/Header';
import HomeSwiper from './components/Swiper';
import HomeIcons from './components/Icons';
import HomeRecommend from './components/Recommend';
import HomeWeekday from './components/Weekday';
import axios from 'axios';
export default {
  name: 'Home',
  data() {
      return {
          city : "",
          swiperList : [],
          IconList : [],
          recommendList : [],
          weekendList : []
      }
  },
  components:{
      HomeHeader,
      HomeSwiper,
      HomeIcons,
      HomeRecommend,
      HomeWeekday
  },
  methods: {
      getHomeInfo () {
          axios.get("/api/index.json").then((res)=>{
            //   console.log(res.data.data)
              res = res.data
            //   console.log (res)
              if(res.ret&&res.data){
                 this.city = res.city
                 this.swiperList = res.data.swiperList
                 this.IconList = res.data.IconList
                 this.recommendList = res.data.recommendList
                 this.weekendList = res.data.weekendList
              }
          })
      }
  },
  mounted() {
      this.getHomeInfo()
  },
}
</script>

<style>

</style>